import java.util.ArrayList;
import java.util.List;
// https://leetcode.cn/problems/subsets/submissions
public class SubSets {
    class Solution {
        private List<List<Integer>> res = new ArrayList<>();
        public List<List<Integer>> subsets(int[] nums) {
            backTracking(new ArrayList<>(), 0 , nums);
            return res;

        }

        private void backTracking(List<Integer> path , int start,int [] nums)
        {
            res.add(new ArrayList<>(path));
            for(int i = start ; i < nums.length ; i ++)
            {
                path.add(nums[i]);
                backTracking(path,i+1,nums);
                path.remove(path.size()-1);
            }
        }
    }
}
